#include "Message.P2.OrderStateChanged.h"

namespace AlgoTrading
{
	namespace Messages
	{
		P2OrderStateChanged::P2OrderStateChanged(void)
			: NotificationMessage(std::auto_ptr<PBServerMessage>(new PBServerMessage()))
		{
			orderStateChanged = notificationMessage->MutableExtension(PBP2OrderStateChanged::notificationMessage);
			notificationMessage->set_type(PBNotificationMessage_Type_PBP2OrderStateChanged);
		}

		P2OrderStateChanged::~P2OrderStateChanged(void)
		{
		}

		P2OrderStateChanged::P2OrderStateChanged(std::auto_ptr<PBServerMessage>& message)
			: NotificationMessage(message)
		{
			orderStateChanged = notificationMessage->MutableExtension(PBP2OrderStateChanged::notificationMessage);
		}


		void P2OrderStateChanged::SetOrderState(OrderState state)
		{
			orderStateChanged->set_state(static_cast<::AlgoTrading::Messages::PBP2OrderStateChanged_State>(state));
		}

		void P2OrderStateChanged::SetAmountRest(::google::protobuf::uint32 amountRest)
		{
			orderStateChanged->set_amountrest(amountRest);
		}

		P2OrderStateChanged::OrderState P2OrderStateChanged::GetOrderState() const
		{
			return static_cast<OrderState>(orderStateChanged->state());
		}

		::google::protobuf::uint32 P2OrderStateChanged::GetAmountRest() const
		{
			return orderStateChanged->amountrest();
		}


		NotificationMessage::NotificationMessageType P2OrderStateChanged::GetNotificationMessageType() const
		{
			return NotificationMessage::ORDER_STATE_CHANGED;
		}

	}
}
